<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<button>1</button>
<button>2</button>
<button>3</button>
<button>4</button>
<button>5</button>
</body>
<script>
    const init = () => {
        const button = document.getElementsByTagName('button');
        const buttonArr = Array.from(button);
        console.log(buttonArr);
        buttonArr.forEach(buttonItem => {
            console.log(buttonItem.innerText);
        })
    };

    window.onload = () => {
        init();
    };
</script>
</html>
